import {UserToken} from "./model/UserToken";
import {HttpService} from "./HttpService";
import {ResponseData} from "./model/ResponseData";
import {Http} from "@angular/http";

import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import {Injectable} from "@angular/core";


@Injectable()
export class CheckUserService extends HttpService{

    protected url="CheckUser";

    protected stateUrl:string="";

    public get RouteUrl():string
    {
        return this.stateUrl;
    }

    public set RouteUrl(value:string)
    {
        this.stateUrl=value;
    }

    public userToken:UserToken=new UserToken();

    constructor(private http:Http){super()}


    public Check():Promise<ResponseData<void>>{

         return this.http.post(this.prefix+this.url,this.userToken)
             .map(response=>{
                return response.json() as ResponseData<void>;
             }).toPromise();
    }

}